<?php
class Rulemanager_Model_Insertrule implements Rulemanager_Model_Mainable{
    
    private $core_controller_csrftoken;
    private $core_controller_notnull;
    
    private $excepted_result = 1;
    private $current_resul;
    
    private $rulemanager_data_insertrule;
    
    public function main(array $variables = null){
        $this->core_controller_csrftoken = new Core_Controller_Tokencheckout;
        $this->core_controller_notnull = new Core_Controller_Notnull;
        $this->core_controller_notnull->main($variables);
        $this->core_controller_csrftoken->main($variables['post']);
        $this->rulemanager_data_insertrule = new Rulemanager_Data_Insertrule;
        $this->current_resul = $this->rulemanager_data_insertrule->main($variables);
        if(
                $this->current_resul == $this->excepted_result
                ){
            header("Location: ".SITE_ROOT."zarzadzaj-rolami.html");
        }
        else {
            header("Location: ".SITE_ROOT."zarzadzaj-rolami.html");
        }
    }
    
}
